/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pkgModuloPrincipal.pkgConfiguracionRegional;

import java.text.DecimalFormat;
import java.text.ParseException;

/**
 *
 * @author Administrador
 */
public class ContextConverter {

    public static DecimalFormat getDecimalFormat() {
        return Context.getSingletonContext().getDECIMAL_FORMAT();
    }

    public static Number parseNumber(String value) throws ParseException {
        return getDecimalFormat().parse(value);
    }

    public static Double parseDoubleWrap(String value) throws ParseException {
        return Double.valueOf(getDecimalFormat().parse(value).toString());
    }

    public static double parseDouble(String value) throws ParseException {
        return Double.valueOf(getDecimalFormat().parse(value).toString()).doubleValue();
    }

    public static String parseString(Double value) throws ParseException {
        String vString = String.valueOf(value);
        return String.valueOf(Double.valueOf(getDecimalFormat().parse(vString).toString()));
    }

    public static String parseString(double value) throws ParseException {
        String vString = String.valueOf(value);
        return String.valueOf(Double.valueOf(getDecimalFormat().parse(vString).toString()));
    }
}
